package ua.cs.stu.ics.dao.dbf;

import ua.cs.stu.ics.dao.ISpecialityDAO;
import ua.cs.stu.ics.dbf.domain.SpecialityDomain;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Admin
 * Date: 26.02.11
 * Time: 14:23
 * To change this template use File | Settings | File Templates.
 */
public class SpecialityDAO implements ISpecialityDAO{
    private ArrayList<SpecialityDomain> list = new ArrayList<SpecialityDomain>();


    public List findAll() {
        return list;
    }

    public void add(SpecialityDomain specialityDomain) {
        list.add(specialityDomain);
    }

    public SpecialityDomain findCodeSpec(String num) {
    	SpecialityDomain ss= new SpecialityDomain();
    	ArrayList<SpecialityDomain> as = (ArrayList<SpecialityDomain>) findAll();
        for (SpecialityDomain sd: as){
            if (sd.getCodSele().contains(num)){
            	ss=sd;
            }
        }
       return ss;
    }

}
